package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.DishVO;
import com.sky.vo.OrderOverViewVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;

@Mapper
public interface DishMapper {

    DishVO getDishById(Integer id);

    @Select("select count(id) from dish where category_id = #{category_id} ")
    Integer getDishByCategoryId(Integer category_id);

    Page<DishVO> DishQuery(DishPageQueryDTO dishPageQueryDTO);

    @AutoFill(value = OperationType.UPDATE)
    void updateDish(Dish dish);

    @AutoFill(value = OperationType.INSERT)
    void addDishWithFlavor(Dish dish);

    @Select("select * from dish where category_id = #{categoryId} ")
    List<DishVO> categoryIdByList(Integer categoryId);

    void updateDishFlavor(DishFlavor dishFlavor);

    void deleteDishesByIds(List<Long> ids);

    void insertBatch(List<DishFlavor> dishFlavors);

    void deleteDishFlavorByIds(List<Long> ids);

    Long getSetmealAndDishById(List<Long> ids);

    Long getDishAndCategoryById(List<Long> ids);

    /**
     * 更具菜品id 查询菜品口味
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{dishId} ")
    List<DishFlavor> getDishFlavorsByDishId(Integer dishId);
    /**
     * 根据套餐id查询包含的菜品
     * @param id
     * @return
     */

    List<DishItemVO> getSetmealByDishId(Integer id);

    List getSetmealByCategoryId(List categoryId);

    DishOverViewVO getDisheStatus();

}
